package com.bjtu.literatureclient.dao.journal;

import com.bjtu.literatureclient.domain.journal.JournalChinese;
import com.bjtu.literatureclient.domain.journal.JournalEnglish;
import com.bjtu.literatureclient.domain.journal.JournalPaperChinese;
import com.bjtu.literatureclient.domain.journal.JournalPaperEnglish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
public interface IJournalDao {

	List<JournalChinese> queryJournalChineseByIndexNo();

	@Select(" SELECT  * FROM journaltable1 ")
	List<JournalEnglish> queryJournalEnglishList();

	@Select("select * from journaltable1 where IndexNo = #{index}")
	JournalEnglish queryJournalEnglishLimit1(@Param("index") String indexNo);

	@Select("select * from journaltable2 where IndexNo = #{indexNo}")
	JournalChinese queryOneJournalChineseByIndexNo(@Param("indexNo") String indexNo);

	// 主键是 indexNo 只会查出一条数据
	@Select("select * from journalpaperstable1 where indexNo = #{indexNo} limit 1")
	JournalPaperEnglish queryJournalPaperEnglishByIndexNo(@Param("indexNo") String indexNo);

	@Select("select * from journalpaperstable2 where indexNo = #{indexNo} limit 1")
	JournalPaperChinese queryJournalPaperChineseByIndexNo(@Param("indexNo") String indexNo);

	List<JournalChinese> queryJournalChineseList();

	Boolean addJournalPaper2(JournalPaperChinese jounalPaperChinese);

	Boolean addJournalPaper1(JournalPaperEnglish jounalPaperEnglish);

	List<JournalPaperChinese> queryJournalPaperChinese(String userNo);

	List<JournalPaperEnglish> queryJournalPaperEnglish(String userNo);

	List<?> queryJournalEnglish();

	boolean editJournalPaper2(JournalPaperChinese jounalPaperChinese);

	boolean editJournalPaper1(JournalPaperEnglish jounalPaperEnglish);

    Object queryJournalPaperByIndexNoEnglish(@Param("userNo") String userNo, @Param("indexNo") String indexNo);

	Object queryJournalPaperByIndexNoChinese(@Param("userNo") String userNo, @Param("indexNo") String indexNo);

	Boolean updateJournalCn(JournalChinese journalChinese);

	Boolean updateJournalEn(JournalEnglish journalEnglish);
}
